<template>
  <div class="titleName" :style="style">
    <slot />
    <span v-if="!$slots.default">{{ title }}</span>
  </div>
</template>

<script>
export default {
  name: 'index',
  props: {
    title: {
      type: String
    },
    /*
    * 字体大小
    * */
    size: {
      type: [String, Number],
      default: 16
    }
  },
  computed: {
    style() {
      return {
        'font-size': this.size + 'px',
        height: Number(this.size) + 4 + 'px',
        'line-height': Number(this.size) + 4 + 'px'
      }
    }
  }
}
</script>

<style scoped>
.titleName {
  border-left: 5px solid #1890ff;
  font-weight: bold;
  font-size: 16px;
  margin-bottom: 20px;
  padding-left: 15px;
  height: 20px;
  line-height: 20px;
  margin-left: 0;
  position: relative;
}


</style>
